package net.siren93.smh.service.impl;

import net.siren93.smh.dao.ProjectDao;
import net.siren93.smh.entity.ProjectEntity;
import net.siren93.smh.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by siren93 on 15/10/7.
 */
@Service("ProjectService")
public class ProjectServiceImpl implements ProjectService {

    @Autowired
    ProjectDao projectDao;

    @Override
    public ProjectEntity findByName(String name) {
        return projectDao.findByName(name);
    }

    @Override
    public ProjectEntity findById(int id) {
        return projectDao.get(id);
    }

    @Override
    public void saveOrUpdate(ProjectEntity entity) {
        projectDao.saveOrUpdate(entity);
    }

    @Override
    public Integer save(ProjectEntity entity) {
        return projectDao.save(entity);
    }

    @Override
    public List<ProjectEntity> listProject() {
        return projectDao.findAll();
    }

    @Override
    public void delById(int id) {
        projectDao.delete(id);
    }

    @Override
    public List<ProjectEntity> findByManager(int id, int page, int rows) {
        return projectDao.findByManager(id, page, rows);
    }
}
